import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'

Vue.use(Router)

export default new Router({
  /* hash 模式: url 会带有# */
  /* history 模式:  */
  mode:'hash',

  routes: [
    {
      path: '/',
      name: '',
      component: Home,
      children: [
        {
          path : '',
          redirect: 'recommend'
        },
        {
          path: 'recommend',
          name: 'recommend',
          // component: () => import('./views/Recommend.vue')
          component: resolve => require(["./views/Recommend.vue"], resolve)
        },
        {
          path: 'hotlist',
          name: 'hotlist',
          // component: () => import('./views/Hotlist.vue')
          component: resolve => require(["./views/Hotlist.vue"], resolve)
        },
        {
          path: 'test',
          name: 'test',
          component: () => import('./views/Test.vue')
        }

      ]
    },
    {
      path: '/songsheet/:id',
      name: 'songsheet',
      component: () => import('./views/SongSheet.vue')
    },
    {
      path: '/player/:id',
      name: 'player',
      component: () => import('./views/Player.vue')
    }
  ]
})
